<?php
class Tentang_Dao{

function __construct(){
		$koneksi = new Koneksi();
		$koneksi->_connect();
	}
	function add(Tentang $tentang){
		
		$sql = "
			INSERT 
			INTO
			tentang_kami
			(
				tentang_kami
			)
			VALUES
			(
				'".$tentang->tentang_kami."'
			)
		";
		mysql_query($sql);
	}
	function get($id_tentang){
	
		
		$sql = "
		SELECT
		*
		FROM
		tentang_kami
		WHERE
		id_tentangkami = '".$id_tentang."'
		";
		
		$tentang = false;
		
		$res = mysql_query($sql);
		
		if($res){
		
			$row = mysql_fetch_assoc($res);
		
			$tentang = new Tentang();
			$tentang->id_tentangkami = $row['id_tentangkami'];
			$tentang->tentang_kami = $row['tentang_kami'];
		}
		
		return $tentang;
	}
	function get_all(){
	
		$sql = "
		SELECT
		*
		FROM
		tentang_kami
		";
		
		$list_tentang = array();
		
		$res = mysql_query($sql);
		if($res){
			while($row = mysql_fetch_assoc($res)){
			
				$tentang = new Tentang();
				
				$tentang->id_tentangkami = $row['id_tentangkami'];
				$tentang->tentang_kami = $row['tentang_kami'];
				
				$list_tentang[] = $tentang;
			
			}
		}
				return $list_tentang;
	
	}
		function edit(Tentang $tentang){
		$sql ="
			UPDATE 
			tentang_kami
			SET
			tentang_kami='$tentang->tentang_kami'
			WHERE 
			id_tentangkami ='$tentang->id_tentangkami'
		";
		mysql_query($sql);
	
	}
	}
	class Tentang{

	var $id_tentang;
	var $tentang_kami;
	

}